

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>geoslurp.dataset.deg1n2 &mdash; geoslurp v1.1.0 documentation</title>
  

  
  
    <link rel="shortcut icon" href="../../../_static/favicon.ico"/>
  
  
  

  

  
  
    

  

  
  
    <link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
  

  

  
        <link rel="index" title="Index"
              href="../../../genindex.html"/>
        <link rel="search" title="Search" href="../../../search.html"/>
    <link rel="top" title="geoslurp v1.1.0 documentation" href="../../../index.html"/>
        <link rel="up" title="Module code" href="../../index.html"/> 

  
  <script src="../../../_static/js/modernizr.min.js"></script>

</head>

<body class="wy-body-for-nav" role="document">

   
  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search">
          

          
            <a href="../../../index.html" class="icon icon-home"> geoslurp
          

          
          </a>

          
            
            
              <div class="version">
                1.1.0
              </div>
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <p class="caption"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../introduction.html">An introduction to Geoslurp</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../installation.html">Installation of the geoslurp package and setting up the PostgreSQL instance</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../confsettings.html">Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../examples.html">Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../reference.html">Reference Documentation</a></li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../index.html">geoslurp</a>
        
      </nav>


      
      <div class="wy-nav-content">
        <div class="rst-content">
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../../index.html">Docs</a> &raquo;</li>
        
          <li><a href="../../index.html">Module code</a> &raquo;</li>
        
      <li>geoslurp.dataset.deg1n2</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <h1>Source code for geoslurp.dataset.deg1n2</h1><div class="highlight"><pre>
<span></span><span class="c1"># This file is part of geoslurp.</span>
<span class="c1"># geoslurp is free software; you can redistribute it and/or</span>
<span class="c1"># modify it under the terms of the GNU Lesser General Public</span>
<span class="c1"># License as published by the Free Software Foundation; either</span>
<span class="c1"># version 3 of the License, or (at your option) any later version.</span>

<span class="c1"># geoslurp is distributed in the hope that it will be useful,</span>
<span class="c1"># but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<span class="c1"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
<span class="c1"># Lesser General Public License for more details.</span>

<span class="c1"># You should have received a copy of the GNU Lesser General Public</span>
<span class="c1"># License along with geoslurp; if not, write to the Free Software</span>
<span class="c1"># Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA</span>

<span class="c1"># Author Roelof Rietbroek (roelof@geod.uni-bonn.de), 2018</span>

<span class="kn">from</span> <span class="nn">sqlalchemy</span> <span class="k">import</span> <span class="n">Column</span><span class="p">,</span><span class="n">Integer</span><span class="p">,</span><span class="n">String</span>
<span class="kn">from</span> <span class="nn">sqlalchemy.dialects.postgresql</span> <span class="k">import</span> <span class="n">TIMESTAMP</span><span class="p">,</span> <span class="n">JSONB</span>
<span class="kn">from</span> <span class="nn">sqlalchemy</span> <span class="k">import</span> <span class="n">MetaData</span>
<span class="kn">from</span> <span class="nn">sqlalchemy.ext.declarative</span> <span class="k">import</span> <span class="n">declarative_base</span>
<span class="kn">from</span> <span class="nn">geoslurp.dataset</span> <span class="k">import</span> <span class="n">DataSet</span>
<span class="kn">from</span> <span class="nn">geoslurp.datapull.ftp</span> <span class="k">import</span> <span class="n">Uri</span> <span class="k">as</span> <span class="n">ftp</span>
<span class="kn">from</span> <span class="nn">geoslurp.datapull.http</span> <span class="k">import</span> <span class="n">Uri</span> <span class="k">as</span> <span class="n">http</span>
<span class="kn">from</span> <span class="nn">datetime</span> <span class="k">import</span> <span class="n">datetime</span><span class="p">,</span><span class="n">timedelta</span>
<span class="kn">from</span> <span class="nn">geoslurp.tools.time</span> <span class="k">import</span> <span class="n">decyear2dt</span><span class="p">,</span><span class="n">dt2monthlyinterval</span>
<span class="kn">from</span> <span class="nn">geoslurp.config.slurplogger</span> <span class="k">import</span> <span class="n">slurplogger</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">import</span> <span class="nn">tarfile</span>
<span class="kn">import</span> <span class="nn">re</span>
<span class="kn">from</span> <span class="nn">copy</span> <span class="k">import</span> <span class="n">deepcopy</span>
<span class="kn">from</span> <span class="nn">geoslurp.config.catalogue</span> <span class="k">import</span> <span class="n">geoslurpCatalogue</span>
<span class="kn">from</span> <span class="nn">geoslurp.tools.gravity</span> <span class="k">import</span> <span class="n">GravitySHTBase</span><span class="p">,</span><span class="n">Trig</span><span class="p">,</span><span class="n">JSONSHArchive</span>


<span class="n">scheme</span><span class="o">=</span><span class="s2">&quot;gravity&quot;</span>

<div class="viewcode-block" id="geocenter_Rietbroeketal2016upd"><a class="viewcode-back" href="../../../reference/geoslurp.dataset.html#geoslurp.dataset.deg1n2.geocenter_Rietbroeketal2016upd">[docs]</a><span class="k">class</span> <span class="nc">geocenter_Rietbroeketal2016upd</span><span class="p">(</span><span class="n">DataSet</span><span class="p">):</span>
    <span class="n">fout</span><span class="o">=</span><span class="s2">&quot;Geocenter_dec2017.tgz&quot;</span>
    <span class="n">sqrt3timesRE</span><span class="o">=</span><span class="mf">11047256.4063275</span>
    <span class="n">scheme</span><span class="o">=</span><span class="n">scheme</span>
    <span class="n">table</span><span class="o">=</span><span class="nb">type</span><span class="p">(</span><span class="s2">&quot;geocenter_Rietbroeketal2016updTable&quot;</span><span class="p">,</span> <span class="p">(</span><span class="n">GravitySHTBase</span><span class="p">,),</span> <span class="p">{})</span>
    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">dbconn</span><span class="p">):</span>
        <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">dbconn</span><span class="p">)</span>
        <span class="c1"># super().__init__(direc=direc,uri=&#39;https://wobbly.earth/data/Geocenter_dec2017.tgz&#39;,order=[&#39;c10&#39;,&#39;c11&#39;,&#39;s11&#39;],lastupdate=datetime(2018,10,16))</span>
    
<div class="viewcode-block" id="geocenter_Rietbroeketal2016upd.pull"><a class="viewcode-back" href="../../../reference/geoslurp.dataset.html#geoslurp.dataset.deg1n2.geocenter_Rietbroeketal2016upd.pull">[docs]</a>    <span class="k">def</span> <span class="nf">pull</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Pulls the geocenter ascii files in the cache&quot;&quot;&quot;</span>
        
        <span class="n">uri</span><span class="o">=</span><span class="n">http</span><span class="p">(</span><span class="s2">&quot;https://wobbly.earth/data/&quot;</span><span class="o">+</span><span class="bp">self</span><span class="o">.</span><span class="n">fout</span><span class="p">,</span><span class="n">lastmod</span><span class="o">=</span><span class="n">datetime</span><span class="p">(</span><span class="mi">2018</span><span class="p">,</span><span class="mi">10</span><span class="p">,</span><span class="mi">16</span><span class="p">))</span><span class="o">.</span><span class="n">download</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">cacheDir</span><span class="p">(),</span><span class="n">check</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span></div>


<div class="viewcode-block" id="geocenter_Rietbroeketal2016upd.register"><a class="viewcode-back" href="../../../reference/geoslurp.dataset.html#geoslurp.dataset.deg1n2.geocenter_Rietbroeketal2016upd.register">[docs]</a>    <span class="k">def</span> <span class="nf">register</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">truncateTable</span><span class="p">()</span>
        <span class="c1">#set general settings</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_dbinvent</span><span class="o">.</span><span class="n">data</span><span class="o">=</span><span class="p">{</span><span class="s2">&quot;citation&quot;</span><span class="p">:</span><span class="s2">&quot;Rietbroek, R., Brunnabend, S.-E., Kusche, J., Schröter, J., Dahle, C., 2016. &quot;</span> \
                                      <span class="s2">&quot;Revisiting the Contemporary Sea Level Budget on Global and Regional Scales. &quot;</span> \
                                      <span class="s2">&quot;Proceedings of the National Academy of Sciences 201519132. &quot;</span> \
                                      <span class="s2">&quot;https://doi.org/10.1073/pnas.1519132113&quot;</span><span class="p">}</span>
        
        <span class="k">with</span> <span class="n">tarfile</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">cacheDir</span><span class="p">(),</span><span class="bp">self</span><span class="o">.</span><span class="n">fout</span><span class="p">),</span><span class="s1">&#39;r:gz&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">tf</span><span class="p">:</span>

            <span class="n">metacomb</span><span class="o">=</span><span class="p">[]</span>

            <span class="n">files</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;Geocenter/GeocentCM-CF_Green.txt&#39;</span><span class="p">,</span>
                    <span class="s1">&#39;Geocenter/GeocentCM-CF_Antarctica.txt&#39;</span><span class="p">,</span>
                   <span class="s1">&#39;Geocenter/GeocentCM-CF_Hydrology.txt&#39;</span><span class="p">,</span>
                   <span class="s1">&#39;Geocenter/GeocentCM-CF_LandGlaciers.txt&#39;</span><span class="p">,</span>
                   <span class="s1">&#39;Geocenter/GeocentCM-CF_GIA.txt&#39;</span><span class="p">,</span>
                   <span class="s1">&#39;Geocenter/GeocentCM-CF_TotSurfload.txt&#39;</span><span class="p">]</span>

            <span class="n">order</span><span class="o">=</span><span class="p">[(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="n">Trig</span><span class="o">.</span><span class="n">c</span><span class="p">),(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="n">Trig</span><span class="o">.</span><span class="n">s</span><span class="p">),(</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="n">Trig</span><span class="o">.</span><span class="n">c</span><span class="p">)]</span>
            <span class="n">lastupdate</span><span class="o">=</span><span class="n">datetime</span><span class="o">.</span><span class="n">now</span><span class="p">()</span>
            <span class="k">for</span> <span class="n">file</span> <span class="ow">in</span> <span class="n">files</span><span class="p">:</span>
                <span class="c1">#get files</span>
                <span class="k">with</span> <span class="n">tf</span><span class="o">.</span><span class="n">extractfile</span><span class="p">(</span><span class="n">file</span><span class="p">)</span> <span class="k">as</span> <span class="n">fid</span><span class="p">:</span>
                    <span class="k">for</span> <span class="n">ln</span> <span class="ow">in</span> <span class="n">fid</span><span class="p">:</span>
                        <span class="n">shar</span><span class="o">=</span><span class="n">JSONSHArchive</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
                        <span class="n">lnspl</span><span class="o">=</span><span class="n">ln</span><span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="s1">&#39;utf-8&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
                        <span class="n">tcent</span><span class="o">=</span><span class="n">decyear2dt</span><span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="n">lnspl</span><span class="p">[</span><span class="mi">0</span><span class="p">]))</span>
                        <span class="n">tstart</span><span class="p">,</span><span class="n">tend</span><span class="o">=</span><span class="n">dt2monthlyinterval</span><span class="p">(</span><span class="n">tcent</span><span class="p">)</span>
                        
                        <span class="n">meta</span><span class="o">=</span><span class="p">{</span><span class="s2">&quot;type&quot;</span><span class="p">:</span><span class="n">file</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;_&#39;</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">][:</span><span class="o">-</span><span class="mi">4</span><span class="p">],</span><span class="s2">&quot;time&quot;</span><span class="p">:</span><span class="n">tcent</span><span class="p">,</span><span class="s2">&quot;tstart&quot;</span><span class="p">:</span><span class="n">tstart</span><span class="p">,</span><span class="s2">&quot;tend&quot;</span><span class="p">:</span><span class="n">tend</span><span class="p">,</span><span class="s2">&quot;lastupdate&quot;</span><span class="p">:</span><span class="n">lastupdate</span><span class="p">,</span><span class="s2">&quot;nmax&quot;</span><span class="p">:</span><span class="mi">1</span><span class="p">,</span><span class="s2">&quot;omax&quot;</span><span class="p">:</span><span class="mi">1</span><span class="p">,</span><span class="s2">&quot;origin&quot;</span><span class="p">:</span><span class="s2">&quot;CF&quot;</span><span class="p">,</span><span class="s2">&quot;format&quot;</span><span class="p">:</span><span class="s2">&quot;JSONB&quot;</span><span class="p">,</span><span class="s2">&quot;uri&quot;</span><span class="p">:</span><span class="s2">&quot;self:data&quot;</span><span class="p">,</span><span class="s2">&quot;gm&quot;</span><span class="p">:</span><span class="mf">0.3986004415e+15</span><span class="p">,</span><span class="s2">&quot;re&quot;</span><span class="p">:</span><span class="mf">0.6378136460e+07</span>
<span class="p">}</span>
                        
                        <span class="k">for</span> <span class="n">el</span><span class="p">,</span><span class="n">val</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">order</span><span class="p">,</span><span class="n">lnspl</span><span class="p">[</span><span class="mi">1</span><span class="p">:</span><span class="mi">4</span><span class="p">]):</span>
                            <span class="c1"># import pdb;pdb.set_trace()</span>
                            <span class="n">shar</span><span class="p">[</span><span class="s2">&quot;cnm&quot;</span><span class="p">][</span><span class="n">shar</span><span class="o">.</span><span class="n">idx</span><span class="p">(</span><span class="n">el</span><span class="p">)]</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="n">val</span><span class="p">)</span><span class="o">/</span><span class="bp">self</span><span class="o">.</span><span class="n">sqrt3timesRE</span>

                        <span class="c1">#also add sigmas </span>
                        <span class="k">for</span> <span class="n">el</span><span class="p">,</span><span class="n">val</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">order</span><span class="p">,</span><span class="n">lnspl</span><span class="p">[</span><span class="mi">4</span><span class="p">:</span><span class="mi">7</span><span class="p">]):</span>
                            <span class="n">shar</span><span class="p">[</span><span class="s2">&quot;sigcnm&quot;</span><span class="p">][</span><span class="n">shar</span><span class="o">.</span><span class="n">idx</span><span class="p">(</span><span class="n">el</span><span class="p">)]</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="n">val</span><span class="p">)</span><span class="o">/</span><span class="bp">self</span><span class="o">.</span><span class="n">sqrt3timesRE</span>
                        <span class="n">meta</span><span class="p">[</span><span class="s2">&quot;data&quot;</span><span class="p">]</span><span class="o">=</span><span class="n">shar</span><span class="o">.</span><span class="n">dict</span>
                        <span class="bp">self</span><span class="o">.</span><span class="n">addEntry</span><span class="p">(</span><span class="n">meta</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">updateInvent</span><span class="p">()</span></div></div>


<span class="n">geoslurpCatalogue</span><span class="o">.</span><span class="n">addDataset</span><span class="p">(</span><span class="n">geocenter_Rietbroeketal2016upd</span><span class="p">)</span>

<div class="viewcode-block" id="parseGSMDate"><a class="viewcode-back" href="../../../reference/geoslurp.dataset.html#geoslurp.dataset.deg1n2.parseGSMDate">[docs]</a><span class="k">def</span> <span class="nf">parseGSMDate</span><span class="p">(</span><span class="n">dtstr</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;Parse datestr as found in GSM files (yyyymmdd.00000)&quot;&quot;&quot;</span>
    <span class="k">return</span> <span class="n">datetime</span><span class="p">(</span><span class="nb">int</span><span class="p">(</span><span class="n">dtstr</span><span class="p">[</span><span class="mi">0</span><span class="p">:</span><span class="mi">4</span><span class="p">]),</span><span class="nb">int</span><span class="p">(</span><span class="n">dtstr</span><span class="p">[</span><span class="mi">4</span><span class="p">:</span><span class="mi">6</span><span class="p">]),</span><span class="nb">int</span><span class="p">(</span><span class="n">dtstr</span><span class="p">[</span><span class="mi">6</span><span class="p">:</span><span class="mi">8</span><span class="p">]))</span>  </div>

<div class="viewcode-block" id="geocenter_GRCRL06_TN13"><a class="viewcode-back" href="../../../reference/geoslurp.dataset.html#geoslurp.dataset.deg1n2.geocenter_GRCRL06_TN13">[docs]</a><span class="k">class</span> <span class="nc">geocenter_GRCRL06_TN13</span><span class="p">(</span><span class="n">DataSet</span><span class="p">):</span>
    <span class="n">scheme</span><span class="o">=</span><span class="n">scheme</span>
    <span class="n">rooturl</span><span class="o">=</span><span class="s2">&quot;https://podaac-tools.jpl.nasa.gov/drive/files/allData/grace/docs/&quot;</span>
    <span class="c1"># fout=&quot;TN-13_GEOC_CSR_RL06.txt&quot;</span>
    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">dbconn</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="o">=</span><span class="nb">type</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s1">&#39;-&#39;</span><span class="p">,</span><span class="s2">&quot;_&quot;</span><span class="p">)</span><span class="o">+</span><span class="s2">&quot;Table&quot;</span><span class="p">,</span> <span class="p">(</span><span class="n">GravitySHTBase</span><span class="p">,),</span> <span class="p">{})</span>
        <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">dbconn</span><span class="p">)</span>
    
<div class="viewcode-block" id="geocenter_GRCRL06_TN13.pull"><a class="viewcode-back" href="../../../reference/geoslurp.dataset.html#geoslurp.dataset.deg1n2.geocenter_GRCRL06_TN13.pull">[docs]</a>    <span class="k">def</span> <span class="nf">pull</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Pulls the geocenter ascii files in the cache&quot;&quot;&quot;</span>
        <span class="n">uri</span><span class="o">=</span><span class="n">http</span><span class="p">(</span><span class="s2">&quot;https://podaac-tools.jpl.nasa.gov/drive/files/allData/grace/docs/&quot;</span><span class="o">+</span><span class="bp">self</span><span class="o">.</span><span class="n">fout</span><span class="p">,</span><span class="n">lastmod</span><span class="o">=</span><span class="n">datetime</span><span class="p">(</span><span class="mi">2019</span><span class="p">,</span><span class="mi">12</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span><span class="o">.</span><span class="n">download</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">cacheDir</span><span class="p">(),</span><span class="n">check</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span></div>


<div class="viewcode-block" id="geocenter_GRCRL06_TN13.register"><a class="viewcode-back" href="../../../reference/geoslurp.dataset.html#geoslurp.dataset.deg1n2.geocenter_GRCRL06_TN13.register">[docs]</a>    <span class="k">def</span> <span class="nf">register</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">truncateTable</span><span class="p">()</span>
        <span class="c1">#set general settings</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_dbinvent</span><span class="o">.</span><span class="n">data</span><span class="o">=</span><span class="p">{</span><span class="s2">&quot;citation&quot;</span><span class="p">:</span><span class="s2">&quot;GRACE technical note 13&quot;</span><span class="p">}</span>
        <span class="n">lastupdate</span><span class="o">=</span><span class="n">datetime</span><span class="o">.</span><span class="n">now</span><span class="p">()</span>
        <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">cacheDir</span><span class="p">(),</span><span class="bp">self</span><span class="o">.</span><span class="n">fout</span><span class="p">),</span><span class="s1">&#39;r&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">fid</span><span class="p">:</span>
            <span class="c1">#skip header</span>
            <span class="k">for</span> <span class="n">ln</span> <span class="ow">in</span> <span class="n">fid</span><span class="p">:</span>
                <span class="k">if</span> <span class="n">re</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="s2">&quot;end of header&quot;</span><span class="p">,</span><span class="n">ln</span><span class="p">):</span>
                    <span class="k">break</span>
            <span class="c1">#loop over entry lines </span>
            <span class="n">shar</span><span class="o">=</span><span class="n">JSONSHArchive</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
            <span class="k">for</span> <span class="n">ln</span> <span class="ow">in</span> <span class="n">fid</span><span class="p">:</span>
                
                <span class="n">tp</span><span class="p">,</span><span class="n">n</span><span class="p">,</span><span class="n">m</span><span class="p">,</span><span class="n">cnm</span><span class="p">,</span><span class="n">snm</span><span class="p">,</span><span class="n">sigcnm</span><span class="p">,</span><span class="n">sigsnm</span><span class="p">,</span><span class="n">ts</span><span class="p">,</span><span class="n">te</span><span class="o">=</span><span class="n">ln</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
                <span class="n">n</span><span class="o">=</span><span class="nb">int</span><span class="p">(</span><span class="n">n</span><span class="p">)</span>
                <span class="n">m</span><span class="o">=</span><span class="nb">int</span><span class="p">(</span><span class="n">m</span><span class="p">)</span>
                <span class="n">shar</span><span class="p">[</span><span class="s2">&quot;cnm&quot;</span><span class="p">][</span><span class="n">shar</span><span class="o">.</span><span class="n">idx</span><span class="p">((</span><span class="n">n</span><span class="p">,</span><span class="n">m</span><span class="p">,</span><span class="n">Trig</span><span class="o">.</span><span class="n">c</span><span class="p">))]</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="n">cnm</span><span class="p">)</span>
                <span class="n">shar</span><span class="p">[</span><span class="s2">&quot;sigcnm&quot;</span><span class="p">][</span><span class="n">shar</span><span class="o">.</span><span class="n">idx</span><span class="p">((</span><span class="n">n</span><span class="p">,</span><span class="n">m</span><span class="p">,</span><span class="n">Trig</span><span class="o">.</span><span class="n">c</span><span class="p">))]</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="n">sigcnm</span><span class="p">)</span>
                <span class="k">if</span> <span class="n">m</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
                    <span class="n">shar</span><span class="p">[</span><span class="s2">&quot;cnm&quot;</span><span class="p">][</span><span class="n">shar</span><span class="o">.</span><span class="n">idx</span><span class="p">((</span><span class="n">n</span><span class="p">,</span><span class="n">m</span><span class="p">,</span><span class="n">Trig</span><span class="o">.</span><span class="n">s</span><span class="p">))]</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="n">snm</span><span class="p">)</span>
                    <span class="n">shar</span><span class="p">[</span><span class="s2">&quot;sigcnm&quot;</span><span class="p">][</span><span class="n">shar</span><span class="o">.</span><span class="n">idx</span><span class="p">((</span><span class="n">n</span><span class="p">,</span><span class="n">m</span><span class="p">,</span><span class="n">Trig</span><span class="o">.</span><span class="n">s</span><span class="p">))]</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="n">sigsnm</span><span class="p">)</span>

                <span class="k">if</span> <span class="n">m</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> 
                    <span class="c1">#register the accumulated entry</span>
                    <span class="n">tstart</span><span class="o">=</span><span class="n">parseGSMDate</span><span class="p">(</span><span class="n">ts</span><span class="p">)</span>
                    <span class="n">tend</span><span class="o">=</span><span class="n">parseGSMDate</span><span class="p">(</span><span class="n">te</span><span class="p">)</span>
                    <span class="c1">#snap the central epoch to the 15th of the month</span>
                    <span class="n">tcent</span><span class="o">=</span><span class="n">datetime</span><span class="p">(</span><span class="n">tstart</span><span class="o">.</span><span class="n">year</span><span class="p">,</span><span class="n">tstart</span><span class="o">.</span><span class="n">month</span><span class="p">,</span><span class="mi">15</span><span class="p">)</span>
                
                    <span class="n">meta</span><span class="o">=</span><span class="p">{</span><span class="s2">&quot;type&quot;</span><span class="p">:</span><span class="s2">&quot;GSM&quot;</span><span class="p">,</span><span class="s2">&quot;time&quot;</span><span class="p">:</span><span class="n">tcent</span><span class="p">,</span><span class="s2">&quot;tstart&quot;</span><span class="p">:</span><span class="n">tstart</span><span class="p">,</span><span class="s2">&quot;tend&quot;</span><span class="p">:</span><span class="n">tend</span><span class="p">,</span><span class="s2">&quot;lastupdate&quot;</span><span class="p">:</span><span class="n">lastupdate</span><span class="p">,</span><span class="s2">&quot;nmax&quot;</span><span class="p">:</span><span class="mi">1</span><span class="p">,</span><span class="s2">&quot;omax&quot;</span><span class="p">:</span><span class="mi">1</span><span class="p">,</span><span class="s2">&quot;origin&quot;</span><span class="p">:</span><span class="s2">&quot;CF&quot;</span><span class="p">,</span><span class="s2">&quot;format&quot;</span><span class="p">:</span><span class="s2">&quot;JSONB&quot;</span><span class="p">,</span><span class="s2">&quot;uri&quot;</span><span class="p">:</span><span class="s2">&quot;self:data&quot;</span><span class="p">,</span><span class="s2">&quot;gm&quot;</span><span class="p">:</span><span class="mf">0.3986004415e+15</span><span class="p">,</span><span class="s2">&quot;re&quot;</span><span class="p">:</span><span class="mf">0.6378136460e+07</span><span class="p">}</span>
                    <span class="n">meta</span><span class="p">[</span><span class="s2">&quot;data&quot;</span><span class="p">]</span><span class="o">=</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">shar</span><span class="o">.</span><span class="n">dict</span><span class="p">)</span>

                    <span class="bp">self</span><span class="o">.</span><span class="n">addEntry</span><span class="p">(</span><span class="n">meta</span><span class="p">)</span>

            <span class="bp">self</span><span class="o">.</span><span class="n">updateInvent</span><span class="p">()</span></div></div>
        
<div class="viewcode-block" id="GRACEGeocFac"><a class="viewcode-back" href="../../../reference/geoslurp.dataset.html#geoslurp.dataset.deg1n2.GRACEGeocFac">[docs]</a><span class="k">def</span> <span class="nf">GRACEGeocFac</span><span class="p">(</span><span class="n">conf</span><span class="p">):</span>
    <span class="n">out</span><span class="o">=</span><span class="p">[]</span>
    <span class="k">for</span> <span class="n">center</span> <span class="ow">in</span> <span class="p">[</span><span class="s2">&quot;CSR&quot;</span><span class="p">,</span> <span class="s2">&quot;GFZ&quot;</span><span class="p">,</span> <span class="s2">&quot;JPL&quot;</span><span class="p">]:</span>
        <span class="n">out</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">type</span><span class="p">(</span><span class="s2">&quot;geocenter_&quot;</span><span class="o">+</span><span class="n">center</span><span class="o">+</span><span class="s2">&quot;RL06_TN13&quot;</span><span class="p">,(</span><span class="n">geocenter_GRCRL06_TN13</span><span class="p">,),{</span><span class="s2">&quot;fout&quot;</span><span class="p">:</span><span class="s2">&quot;TN-13_GEOC_&quot;</span><span class="o">+</span><span class="n">center</span><span class="o">+</span><span class="s2">&quot;_RL06.txt&quot;</span><span class="p">}))</span>
    <span class="k">return</span> <span class="n">out</span></div>



<span class="n">geoslurpCatalogue</span><span class="o">.</span><span class="n">addDatasetFactory</span><span class="p">(</span><span class="n">GRACEGeocFac</span><span class="p">)</span>


<div class="viewcode-block" id="geocenter_RIES_CFCM"><a class="viewcode-back" href="../../../reference/geoslurp.dataset.html#geoslurp.dataset.deg1n2.geocenter_RIES_CFCM">[docs]</a><span class="k">class</span> <span class="nc">geocenter_RIES_CFCM</span><span class="p">(</span><span class="n">DataSet</span><span class="p">):</span>
    <span class="n">fout30</span><span class="o">=</span><span class="s2">&quot;GCN_L1_L2_30d_CF-CM.txt&quot;</span>
    <span class="n">fout60</span><span class="o">=</span><span class="s2">&quot;GCN_L1_L2_60d_CF-CM.txt&quot;</span>
    <span class="c1">#note also embed mm to meter conversion in here (e3)</span>
    <span class="n">sqrt3timesRE</span><span class="o">=</span><span class="mf">11047256.23312e3</span>
    <span class="n">scheme</span><span class="o">=</span><span class="n">scheme</span>
    <span class="n">table</span><span class="o">=</span><span class="nb">type</span><span class="p">(</span><span class="s2">&quot;geocenter_ries_cfcmTable&quot;</span><span class="p">,</span> <span class="p">(</span><span class="n">GravitySHTBase</span><span class="p">,),</span> <span class="p">{})</span>
    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">dbconn</span><span class="p">):</span>
        <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">dbconn</span><span class="p">)</span>
        <span class="c1"># super().__init__(direc=direc,uri=&#39;https://wobbly.earth/data/Geocenter_dec2017.tgz&#39;,order=[&#39;c10&#39;,&#39;c11&#39;,&#39;s11&#39;],lastupdate=datetime(2018,10,16))</span>
    
<div class="viewcode-block" id="geocenter_RIES_CFCM.pull"><a class="viewcode-back" href="../../../reference/geoslurp.dataset.html#geoslurp.dataset.deg1n2.geocenter_RIES_CFCM.pull">[docs]</a>    <span class="k">def</span> <span class="nf">pull</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Pulls the geocenter ascii files in the cache&quot;&quot;&quot;</span>
        
        <span class="n">uri</span><span class="o">=</span><span class="n">http</span><span class="p">(</span><span class="s2">&quot;http://download.csr.utexas.edu/pub/slr/geocenter/&quot;</span><span class="o">+</span><span class="bp">self</span><span class="o">.</span><span class="n">fout30</span><span class="p">)</span><span class="o">.</span><span class="n">download</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">cacheDir</span><span class="p">())</span>
        <span class="n">uri</span><span class="o">=</span><span class="n">http</span><span class="p">(</span><span class="s2">&quot;http://download.csr.utexas.edu/pub/slr/geocenter/&quot;</span><span class="o">+</span><span class="bp">self</span><span class="o">.</span><span class="n">fout60</span><span class="p">)</span><span class="o">.</span><span class="n">download</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">cacheDir</span><span class="p">())</span></div>


<div class="viewcode-block" id="geocenter_RIES_CFCM.register"><a class="viewcode-back" href="../../../reference/geoslurp.dataset.html#geoslurp.dataset.deg1n2.geocenter_RIES_CFCM.register">[docs]</a>    <span class="k">def</span> <span class="nf">register</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">truncateTable</span><span class="p">()</span>
        <span class="c1">#set general settings</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_dbinvent</span><span class="o">.</span><span class="n">data</span><span class="o">=</span><span class="p">{</span><span class="s2">&quot;citation&quot;</span><span class="p">:</span><span class="s2">&quot;Ries, J.C., 2016. Reconciling estimates of annual geocenter motion from space geodesy, in: Proceedings of the 20th International Workshop on Laser Ranging, Potsdam, Germany. pp. 10–14.&quot;</span><span class="p">}</span>
        
            
        <span class="bp">self</span><span class="o">.</span><span class="n">extractSLR</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">cacheDir</span><span class="p">(),</span><span class="bp">self</span><span class="o">.</span><span class="n">fout30</span><span class="p">))</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">extractSLR</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">cacheDir</span><span class="p">(),</span><span class="bp">self</span><span class="o">.</span><span class="n">fout60</span><span class="p">))</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">updateInvent</span><span class="p">()</span></div>

<div class="viewcode-block" id="geocenter_RIES_CFCM.extractSLR"><a class="viewcode-back" href="../../../reference/geoslurp.dataset.html#geoslurp.dataset.deg1n2.geocenter_RIES_CFCM.extractSLR">[docs]</a>    <span class="k">def</span> <span class="nf">extractSLR</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">filen</span><span class="p">):</span>
            <span class="n">lastupdate</span><span class="o">=</span><span class="n">datetime</span><span class="o">.</span><span class="n">now</span><span class="p">()</span>
            <span class="n">order</span><span class="o">=</span><span class="p">[(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="n">Trig</span><span class="o">.</span><span class="n">c</span><span class="p">),(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="n">Trig</span><span class="o">.</span><span class="n">s</span><span class="p">),(</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="n">Trig</span><span class="o">.</span><span class="n">c</span><span class="p">)]</span>
            <span class="k">if</span> <span class="n">re</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="s1">&#39;30d&#39;</span><span class="p">,</span><span class="n">filen</span><span class="p">):</span>
                <span class="n">dt</span><span class="o">=</span><span class="n">timedelta</span><span class="p">(</span><span class="n">days</span><span class="o">=</span><span class="mi">15</span><span class="p">)</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">dt</span><span class="o">=</span><span class="n">timedelta</span><span class="p">(</span><span class="n">days</span><span class="o">=</span><span class="mi">30</span><span class="p">)</span>

            <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">filen</span><span class="p">,</span><span class="s1">&#39;r&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">fid</span><span class="p">:</span>
                <span class="c1">#skip header</span>
                <span class="n">fid</span><span class="o">.</span><span class="n">readline</span><span class="p">()</span>
                <span class="k">for</span> <span class="n">ln</span> <span class="ow">in</span> <span class="n">fid</span><span class="p">:</span>
                    <span class="n">shar</span><span class="o">=</span><span class="n">JSONSHArchive</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
                    <span class="n">lnspl</span><span class="o">=</span><span class="n">ln</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
                    <span class="c1">#note little hack as the 60d file version has an empty line at the back</span>
                    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">lnspl</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
                        <span class="k">break</span>
                    <span class="n">tcent</span><span class="o">=</span><span class="n">decyear2dt</span><span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="n">lnspl</span><span class="p">[</span><span class="mi">0</span><span class="p">]))</span>
                    <span class="n">tstart</span><span class="o">=</span><span class="n">tcent</span><span class="o">-</span><span class="n">dt</span>
                    <span class="n">tend</span><span class="o">=</span><span class="n">tcent</span><span class="o">+</span><span class="n">dt</span>
                    
                    <span class="n">meta</span><span class="o">=</span><span class="p">{</span><span class="s2">&quot;type&quot;</span><span class="p">:</span><span class="s2">&quot;GSM&quot;</span><span class="o">+</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">filen</span><span class="p">)[</span><span class="mi">10</span><span class="p">:</span><span class="mi">13</span><span class="p">],</span><span class="s2">&quot;time&quot;</span><span class="p">:</span><span class="n">tcent</span><span class="p">,</span><span class="s2">&quot;tstart&quot;</span><span class="p">:</span><span class="n">tstart</span><span class="p">,</span><span class="s2">&quot;tend&quot;</span><span class="p">:</span><span class="n">tend</span><span class="p">,</span><span class="s2">&quot;lastupdate&quot;</span><span class="p">:</span><span class="n">lastupdate</span><span class="p">,</span><span class="s2">&quot;nmax&quot;</span><span class="p">:</span><span class="mi">1</span><span class="p">,</span><span class="s2">&quot;omax&quot;</span><span class="p">:</span><span class="mi">1</span><span class="p">,</span><span class="s2">&quot;origin&quot;</span><span class="p">:</span><span class="s2">&quot;CF&quot;</span><span class="p">,</span><span class="s2">&quot;format&quot;</span><span class="p">:</span><span class="s2">&quot;JSONB&quot;</span><span class="p">,</span><span class="s2">&quot;uri&quot;</span><span class="p">:</span><span class="s2">&quot;self:data&quot;</span><span class="p">,</span><span class="s2">&quot;gm&quot;</span><span class="p">:</span><span class="mf">0.3986004415e+15</span><span class="p">,</span><span class="s2">&quot;re&quot;</span><span class="p">:</span><span class="mf">0.6378136460e+07</span>
<span class="p">}</span>
                    
                    <span class="k">for</span> <span class="n">el</span><span class="p">,</span><span class="n">val</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">order</span><span class="p">,</span><span class="n">lnspl</span><span class="p">[</span><span class="mi">1</span><span class="p">:</span><span class="mi">4</span><span class="p">]):</span>
                        <span class="n">shar</span><span class="p">[</span><span class="s2">&quot;cnm&quot;</span><span class="p">][</span><span class="n">shar</span><span class="o">.</span><span class="n">idx</span><span class="p">(</span><span class="n">el</span><span class="p">)]</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="n">val</span><span class="p">)</span><span class="o">/</span><span class="bp">self</span><span class="o">.</span><span class="n">sqrt3timesRE</span>

                    <span class="c1">#also add sigmas </span>
                    <span class="k">for</span> <span class="n">el</span><span class="p">,</span><span class="n">val</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">order</span><span class="p">,</span><span class="n">lnspl</span><span class="p">[</span><span class="mi">4</span><span class="p">:</span><span class="mi">7</span><span class="p">]):</span>
                        <span class="n">shar</span><span class="p">[</span><span class="s2">&quot;sigcnm&quot;</span><span class="p">][</span><span class="n">shar</span><span class="o">.</span><span class="n">idx</span><span class="p">(</span><span class="n">el</span><span class="p">)]</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="n">val</span><span class="p">)</span><span class="o">/</span><span class="bp">self</span><span class="o">.</span><span class="n">sqrt3timesRE</span>
                    <span class="n">meta</span><span class="p">[</span><span class="s2">&quot;data&quot;</span><span class="p">]</span><span class="o">=</span><span class="n">shar</span><span class="o">.</span><span class="n">dict</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">addEntry</span><span class="p">(</span><span class="n">meta</span><span class="p">)</span></div></div>

<span class="n">geoslurpCatalogue</span><span class="o">.</span><span class="n">addDataset</span><span class="p">(</span><span class="n">geocenter_RIES_CFCM</span><span class="p">)</span>

<span class="c1"># class Sun2017Comb(LowdegreeSource):</span>
    <span class="c1"># def __init__(self,direc,uri=None):</span>
        <span class="c1"># if not uri:</span>
            <span class="c1"># uri=&#39;https://d1rkab7tlqy5f1.cloudfront.net/CiTG/Over%20faculteit/Afdelingen/&#39; \</span>
                <span class="c1"># &#39;Geoscience%20%26%20Remote%20sensing/Research/Gravity/models%20and%20data/3_Deg1_C20_CMB.txt&#39;</span>
        <span class="c1"># lastupdate=datetime(2018,1,1)</span>
        <span class="c1"># super().__init__(direc=direc,uri=uri,lastupdate=lastupdate)</span>
    <span class="c1"># def extract(self):</span>
        <span class="c1"># singlemeta=self.meta</span>

        <span class="c1"># citation=&quot;Reference: Yu Sun, Pavel Ditmar, Riccardo Riva (2017), Statistically optimal&quot; \</span>
                                       <span class="c1"># &quot; estimation of degree-1 and C20 coefficients based on GRACE data and an &quot; \</span>
                                       <span class="c1"># &quot;ocean bottom pressure model Geophysical Journal International, 210(3), &quot; \</span>
                                       <span class="c1"># &quot;1305-1322, 2017. doi:10.1093/gji/ggx241.&quot;</span>


        <span class="c1"># valorder=[&#39;c10&#39;,&#39;c11&#39;,&#39;s11&#39;]</span>
        <span class="c1"># covorder=[(&#39;c10&#39;,&#39;c10&#39;),(&#39;c10&#39;,&#39;c11&#39;),(&#39;c10&#39;,&#39;s11&#39;),(&#39;c10&#39;,&#39;c20&#39;),(&#39;c11&#39;,&#39;c11&#39;),(&#39;c11&#39;,&#39;s11&#39;),(&#39;c11&#39;,&#39;c20&#39;),(&#39;s11&#39;,&#39;s11&#39;),(&#39;s11&#39;,&#39;c20&#39;),(&#39;c20&#39;,&#39;c20&#39;)]</span>

        <span class="c1"># singlemeta[&#39;data&#39;][&quot;citation&quot;]=citation</span>
        <span class="c1"># with open(os.path.join(self.direc,self.fout),&#39;rt&#39;) as fid:</span>
            <span class="c1"># dataregex=re.compile(&#39;^ +[0-9]&#39;)</span>
            <span class="c1"># time=[]</span>
            <span class="c1"># for ln in fid:</span>
                <span class="c1"># if dataregex.match(ln):</span>
                    <span class="c1"># lnspl=ln.split()</span>
                    <span class="c1"># time.append(decyear2dt(float(lnspl[0])))</span>
                    <span class="c1"># d12=[0]*4</span>
                    <span class="c1"># for el,val in zip(valorder,lnspl[1:4]):</span>
                        <span class="c1"># d12[self.dindex(el)]=val</span>
                    <span class="c1"># singlemeta[&#39;data&#39;][&#39;d12&#39;].append(d12)</span>


                    <span class="c1"># covUpper=[0]*10</span>
                    <span class="c1"># for (el1,el2),val in zip(covorder,lnspl[5:]):</span>
                        <span class="c1"># covUpper[self.covindex(el1,el2)]=val</span>
                    <span class="c1"># singlemeta[&#39;data&#39;][&#39;covUpper&#39;].append(covUpper)</span>

        <span class="c1"># singlemeta[&quot;data&quot;][&quot;time&quot;]=[dt.isoformat() for dt in time]</span>
        <span class="c1"># singlemeta[&#39;tstart&#39;]=min(time)</span>
        <span class="c1"># singlemeta[&#39;tend&#39;]=max(time)</span>
        <span class="c1"># singlemeta[&#39;lastupdate&#39;]=datetime.now()</span>

        <span class="c1"># return [singlemeta]</span>

<span class="c1"># class Sun2017Comb_GIArestored(Sun2017Comb):</span>
        <span class="c1"># def __init__(self,direc):</span>
            <span class="c1"># uri=&quot;https://d1rkab7tlqy5f1.cloudfront.net/CiTG/Over%20faculteit/Afdelingen/&quot; \</span>
                     <span class="c1"># &quot;Geoscience%20%26%20Remote%20sensing/Research/Gravity/models%20and%20data/&quot; \</span>
                     <span class="c1"># &quot;4_Deg1_C20_CMB_GIA_restored.txt&quot;</span>
            <span class="c1"># super().__init__(direc,uri)</span>

<span class="c1"># class GeocTable(GeocTBase):</span>
    <span class="c1"># &quot;&quot;&quot;Defines the Geocenter motion table&quot;&quot;&quot;</span>
    <span class="c1"># __tablename__=&#39;deg1n2&#39;</span>
    <span class="c1"># id=Column(Integer,primary_key=True)</span>
    <span class="c1"># name=Column(String,unique=True)</span>
    <span class="c1"># lastupdate=Column(TIMESTAMP)</span>
    <span class="c1"># tstart=Column(TIMESTAMP)</span>
    <span class="c1"># tend=Column(TIMESTAMP)</span>
    <span class="c1"># origin=Column(String)</span>
    <span class="c1"># data=Column(JSONB)</span>

    <span class="c1"># &quot;ftp://ftp.csr.utexas.edu/pub/slr/geocenter/&quot;</span>
    <span class="c1">#     # {&#39;name&#39;:&#39;Rietbroeketal2016updated&#39;,&#39;uri&#39;:&#39;https://wobbly.earth/data/Geocenter_dec2017.tgz&#39;,&#39;lastupdate&#39;:datetime(2018,10,16)},</span>
    <span class="c1">#     # {&#39;name&#39;:&#39;SwensonWahr2008&#39;,&#39;uri&#39;:&#39;ftp://podaac.jpl.nasa.gov/allData/tellus/L2/degree_1/deg1_coef.txt&#39;,&#39;lastupdate&#39;:datetime(2018,10,16)},</span>
    <span class="c1">#     # {&#39;name&#39;:&#39;Sun2017Comb&#39;,&#39;uri&#39;:&#39;https://d1rkab7tlqy5f1.cloudfront.net/CiTG/Over%20faculteit/Afdelingen/Geoscience%20%26%20Remote%20sensing/Research/Gravity/models%20and%20data/3_Deg1_C20_CMB.txt&#39;</span>
    <span class="c1">#     #                             ,&#39;lastupdate&#39;:datetime(2018,10,16)},</span>
    <span class="c1"># ]</span>


</pre></div>

           </div>
           <div class="articleComments">
            
           </div>
          </div>
          <footer>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2020, Roelof Rietbroek.

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  

    <script type="text/javascript">
        var DOCUMENTATION_OPTIONS = {
            URL_ROOT:'../../../',
            VERSION:'v1.1.0',
            COLLAPSE_INDEX:false,
            FILE_SUFFIX:'.html',
            HAS_SOURCE:  true,
            SOURCELINK_SUFFIX: '.txt'
        };
    </script>
      <script type="text/javascript" src="../../../_static/jquery.js"></script>
      <script type="text/javascript" src="../../../_static/underscore.js"></script>
      <script type="text/javascript" src="../../../_static/doctools.js"></script>

  

  
  
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>
  

  
  
  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.StickyNav.enable();
      });
  </script>
   

</body>
</html>